package com.apes.hr.group.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.hr.base.model.WorkPost;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import com.apes.scm.masterdata.frame.model.Branch;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：钉钉部门详细表
 * @author ZhengZX
 * @create 2020年9月15日11:05:36
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = DingDingDeptDetail.CONST_TABLE_NAME)
public class DingDingDeptDetail extends Model {
    public static final String CONST_TABLE_NAME = "hr_ding_ding_dept_detail";

    @Id
    @Column(name = "id", nullable = false, length = 120)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "钉钉部门规则")
    @Comment("编码")
    private String id; //编码

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ding_ding_dept_id", referencedColumnName = "id")
    private DingDingDept dingDingDept; //钉钉部门

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "work_post_id", referencedColumnName = "id")
    @Comment("行政岗位编码")
    private WorkPost workPost; //行政岗位

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "branch_id", referencedColumnName = "id")
    @Comment("行政部门编码")
    private Branch branch;  //行政部门编码

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "company_id", referencedColumnName = "id")
    @Comment("公司")
    private PartyRole company; //公司

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "operation", referencedColumnName = "id")
    @Comment("运营模式编码")
    private Enumeration operation; //运营模式

}
